#例一.输出数字
def fun(*para):
    avg = sum(para)/len(para)
    g = [i for i in para if i>avg]#列表生成式
    return (avg,g)
m ,l = fun(6.7,2.4,-0.1,2.15,-5.8)
print('平均值:',m)
print('大于均值的数：',l)

###例二.输出每个短语的首字母大写
##def edf(s):
##    lst = s.split()
##    return [x[0].upper() for x in lst]
##s=input("请输入短语:")
##print(''.join(edf(s)))

#例三.打字测试
def rate(origin,userInput):
    right = 0
    for origin_char,user_char in zip(origin,userInput):
        if origin_char == user_char:
            right+=1;
    return right/len(origin)
origin = 'Your smill will make my whole world bright.'
print(origin)
userInput = input('输入:')
if len(origin)!=len(userInput):
    print('字符串长度不一致，请重新输入')
else:
    print('准确率：{:.2%}'.format(rate(origin,userInput)))
